Skip to content

Add dispatch open --stdin to batch resume sessions from piped IDs#311

Merged
jongio merged 2 commits into
mainfrom
idea/open-stdin
Jul 14, 2026
Merged

Add dispatch open --stdin to batch resume sessions from piped IDs#311
jongio merged 2 commits into
mainfrom
idea/open-stdin

Conversation

@jongio

@jongio jongio commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Adds dispatch open --stdin to resume many sessions at once from IDs piped on standard input, one per line.

What changed

  • open --stdin reads session IDs from standard input and resumes each valid one.
  • Input parsing trims lines, skips blanks and # comments, takes the first field of each line, and drops duplicates while preserving order.
  • Each ID is alias-resolved before lookup, matching single-session open.
  • Batch resume requires --mode tab|window|pane or --print; inplace launch is rejected because it cannot host multiple sessions.
  • --stdin --print prints the resume command per session instead of launching.
  • Partial failures resume the good IDs, print a resumed N of M sessions summary, and exit non-zero with an aggregated error.
  • --stdin is mutually exclusive with a positional ID and with --last.

Testing

  • go build ./..., go vet ./..., go test ./... -count=1 all green.
  • golangci-lint run reports 0 issues; mage deadcode OK.
  • New unit tests cover parsing, batch launch, alias resolution, inplace rejection, empty input, partial failure, and --print.

Also drains the stdout pipe on a goroutine in TestPrintUsage_Output so the grown usage banner cannot deadlock on the smaller Windows pipe buffer.

Closes #310

Resume many sessions in one shot by piping IDs into `open --stdin`,
one per line. Composes with any command that emits session IDs, such
as `search --ids`. Blank and `#` comment lines are skipped, only the
first field of each line is read, and duplicate IDs are dropped while
preserving order. Each ID is alias-resolved like single-session open.

Batch resume needs an explicit launch target (`--mode tab|window|pane`)
or `--print`, since inplace launch cannot host multiple sessions. A
missing or unresumable ID does not abort the run: the rest resume, a
`resumed N of M sessions` summary prints, and the command exits with an
aggregated error. `--stdin` is rejected alongside a positional ID or
`--last`.

Also drains the stdout pipe on a goroutine in TestPrintUsage_Output so
the grown usage banner cannot deadlock on the Windows pipe buffer.

Closes #310

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 13, 2026
@jongio jongio self-assigned this Jul 13, 2026
@jongio jongio merged commit 5331602 into main Jul 14, 2026
2 checks passed
@jongio jongio deleted the idea/open-stdin branch July 14, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dispatch open --stdin to batch resume sessions from piped IDs

1 participant